//
//  MyFighterDetailFourthCell.m
//  u76ho
//
//  Created by m-air-01 on 15/12/28.
//  Copyright © 2015年 LV. All rights reserved.
//

#import "MyFighterDetailFourthCell.h"

@implementation MyFighterDetailFourthCell

- (void)awakeFromNib {
    // Initialization code
}
-(void)setPicArr:(NSArray *)picArr
{
    _picArr = picArr;
    
    if (picArr.count == 0) {
        _firstImgV.hidden = YES;
        _secondImgV.hidden = YES;
        _thirdImgV.hidden = YES;
    }
    else if(picArr.count == 1)
    {
        _firstImgV.hidden = NO;
        _secondImgV.hidden = YES;
        _thirdImgV.hidden = YES;
        friendDynaModel * model = picArr[0];
        
        NSRange range = [model.pic rangeOfString:@"|"];
        if (range.location != NSNotFound) {
            NSMutableArray * arr0 = [[NSMutableArray alloc]init];
            [arr0 addObjectsFromArray:[model.pic componentsSeparatedByString:@"|"]];
//            [_firstImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]]];
            
            [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _firstImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
                
            }];

        }
        else
        {
//            [_firstImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model.pic]]];
            
            [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model.pic]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _firstImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
                
            }];
            
        }
    }
    else if (picArr.count == 2)
    {
        _firstImgV.hidden = NO;
        _secondImgV.hidden = NO;
        _thirdImgV.hidden = YES;
        friendDynaModel * model = picArr[0];
        NSRange range = [model.pic rangeOfString:@"|"];
        if (range.location != NSNotFound) {
            NSMutableArray * arr0 = [[NSMutableArray alloc]init];
            [arr0 addObjectsFromArray:[model.pic componentsSeparatedByString:@"|"]];
//            [_firstImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]]];
            
            [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _firstImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
                
            }];
            
        }
        else
        {
//            [_firstImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model.pic]]];
            
            [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model.pic]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _firstImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];
            
        }

        friendDynaModel * model2 = picArr[1];
        
        NSRange range2 = [model2.pic rangeOfString:@"|"];
        if (range2.location != NSNotFound) {
            NSMutableArray * arr0 = [[NSMutableArray alloc]init];
            [arr0 addObjectsFromArray:[model2.pic componentsSeparatedByString:@"|"]];
//            [_secondImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]]];
            
            [_secondImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _secondImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];

        }
        else
        {
//            [_secondImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model2.pic]]];
            [_secondImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model2.pic]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _secondImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];
        }
        
    }
    else
    {
        _firstImgV.hidden = NO;
        _secondImgV.hidden = NO;
        _thirdImgV.hidden = NO;
        
        friendDynaModel * model = picArr[0];
        NSRange range = [model.pic rangeOfString:@"|"];
        if (range.location != NSNotFound) {
            NSMutableArray * arr0 = [[NSMutableArray alloc]init];
            [arr0 addObjectsFromArray:[model.pic componentsSeparatedByString:@"|"]];
//            [_firstImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]]];
            
            [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _firstImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];
            
            
        }
        else
        {
//            [_firstImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model.pic]]];
            [_firstImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model.pic]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _firstImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];
        }
        
        friendDynaModel * model2 = picArr[1];
        
        NSRange range2 = [model2.pic rangeOfString:@"|"];
        if (range2.location != NSNotFound) {
            NSMutableArray * arr0 = [[NSMutableArray alloc]init];
            [arr0 addObjectsFromArray:[model2.pic componentsSeparatedByString:@"|"]];
//            [_secondImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]]];
            
            [_secondImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _secondImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];
            
        }
        else
        {
//            [_secondImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model2.pic]]];
            
            [_secondImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model2.pic]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _secondImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];
        }
        
        
        friendDynaModel * model3 = picArr[2];
        
        NSRange range3 = [model3.pic rangeOfString:@"|"];
        if (range3.location != NSNotFound) {
            NSMutableArray * arr0 = [[NSMutableArray alloc]init];
            [arr0 addObjectsFromArray:[model3.pic componentsSeparatedByString:@"|"]];
//            [_thirdImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]]];
            
            [_thirdImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,arr0.firstObject]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _thirdImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];

        }
        else
        {
//            [_thirdImgV setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model3.pic]]];
            
            [_thirdImgV sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",U76HOURL,model3.pic]] placeholderImage:[UIImage imageNamed:@"在职公司－默认动态图"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
                
                
                
                dispatch_async(dispatch_get_main_queue(), ^{
                    float tempW = (image.size.height - image.size.width) >= 0 ? image.size.width : image.size.height;
                    _thirdImgV.image = [image croppedImageAtFrame:CGRectMake((image.size.height - image.size.width) >= 0 ? 0 : (image.size.width - image.size.height)/2, (image.size.width - image.size.height) >= 0 ? 0 : (image.size.height - image.size.width)/2 , tempW, tempW)];
                });
            }];
        }
        
    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
